package io.renren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.dao.ArticalDao;
import io.renren.entity.ArticalEntity;
import io.renren.service.ArticalService;
import io.renren.utils.Query;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * describe:
 * create @ kylin  2019/02/27
 */
@Service("articalService")
public class ArticalServiceImpl extends ServiceImpl<ArticalDao, ArticalEntity> implements ArticalService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<ArticalEntity> page = this.page(
                new Query<ArticalEntity>().getPage(params),
                new QueryWrapper<ArticalEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public ArrayList<ArticalEntity> findAll() {
        return this.baseMapper.findAll();
    }

    @Override
    public  Integer addReadNum(Integer id) {
        return this.baseMapper.addReadNum(id);
    }

    @Override
    public ArticalEntity getartical(Integer id) {
        return this.baseMapper.getartical(id);
    }

    @Override
    public Integer articalCount() throws Exception {
        return this.baseMapper.articalCount();
    }

    @Override
    public List<ArticalEntity> addArticalListNum(Integer id) throws Exception {
        return this.baseMapper.addArticalListNum(id);
    }

}

